/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package interfacegraphique;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 *
 * @author CYRIL
 */
public class MessageErreur extends JFrame{

    private JLabel message;
    private JPanel conteneur;
    private JButton ok;

    public MessageErreur(String s){
        
        this.message = new JLabel(s, JLabel.CENTER);
        this.conteneur = new JPanel();
        this.ok = new JButton("OK");

        this.ok.addActionListener(new ActionListener(){
                public void actionPerformed(ActionEvent e){
                    MessageErreur.this.dispose();
                }
        });

        this.conteneur.setLayout(new BorderLayout());
        this.conteneur.add(this.message, BorderLayout.CENTER);
        
        JPanel panel = new JPanel();
        panel.add(this.ok);        
        this.conteneur.add(panel, BorderLayout.SOUTH);
        
        this.add(this.conteneur);

        this.setTitle("Erreur");
        this.setSize(s.length()*10, 85);
        this.setResizable(false);
        this.setLocationRelativeTo(null);
        this.setVisible(true);


    }

}
